<%@ page language="java" contentType="text/html;charset=utf-8" %>
<%@page import="cn.jdy.common.ctrl.SessionListener" %>
<%@page import="cn.jdy.common.init.InitServlet" %>
<%@page import="cn.jdy.framework.util.SpringContextUtils" %>
<%@page import="javax.sql.DataSource" %>
<%@page import="java.util.Date" %>
<!DOCTYPE HTML>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<head>
    <jsp:include page="../common/common.jsp"/>
</head>
<body class="page-header-fixed page-sidebar-fixed">
<!-- BEGIN HEADER -->
<jsp:include page="../common/header.jsp"/>
<%
    java.util.Properties sysInfo = System.getProperties();// 获取系统信息

    DataSource ds = SpringContextUtils.getBean(DataSource.class);// 获取数据库信息
    java.sql.Connection conn = ds.getConnection();
    java.sql.DatabaseMetaData dbmd = conn.getMetaData();
%>
<div class="clearfix">
</div>
<div class="page-container">
    <div class="page-sidebar-wrapper">
        <jsp:include page="../common/menu.jsp"/>
    </div>
    <div class="page-content-wrapper">
        <div class="page-content">
            <!-- BEGIN DASHBOARD STATS -->
            <div class="row">
                <div class="col-md-6 col-sm-12">
                    <div class="portlet yellow box">
                        <div class="portlet-title">
                            <div class="caption">
                                <i class="fa fa-cogs"></i>平台信息
                            </div>
                        </div>
                        <div class="portlet-body">
                            <div class="row static-info">
                                <div class="col-md-5 name">平台名称:</div>
                                <div class="col-md-7 value">筋斗云-多渠道服务平台</div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">平台版本:</div>
                                <div class="col-md-7 value">
                                    <span class="label label-success">v3.1</span>
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">本次启动时间:</div>
                                <div class="col-md-7 value">
                                    <%=InitServlet.startime.toLocaleString() %>
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">
                                    当前己登录用户数：
                                </div>
                                <div class="col-md-7 value">
                                    <%=SessionListener.count %>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-6 col-sm-12">
                    <div class="portlet blue box">
                        <div class="portlet-title">
                            <div class="caption">
                                <i class="fa fa-cogs"></i>服务器信息
                            </div>
                        </div>
                        <div class="portlet-body">
                            <div class="row static-info">
                                <div class="col-md-5 name">
                                    服务器:
                                </div>
                                <div class="col-md-7 value">
                                    <%=request.getServerName() %>&nbsp;(<%=request.getRemoteAddr() %>)
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">
                                    服务器操作系统:
                                </div>
                                <div class="col-md-7 value">
                                    <%=sysInfo.getProperty("os.name") %>&nbsp;,<%=sysInfo.getProperty("os.version") %>
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">
                                    服务器操作系统类型:
                                </div>
                                <div class="col-md-7 value">
                                    <%=sysInfo.getProperty("os.arch") %>
                                    &nbsp;,&nbsp;<%=sysInfo.getProperty("sun.arch.data.model") %>位
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">
                                    服务器时间:
                                </div>
                                <div class="col-md-7 value">
                                    <%=new Date().toLocaleString() %>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-6 col-sm-12">
                    <div class="portlet green box">
                        <div class="portlet-title">
                            <div class="caption">
                                <i class="fa fa-cogs"></i>基础软件信息
                            </div>
                        </div>
                        <div class="portlet-body">
                            <div class="row static-info">
                                <div class="col-md-5 name">JAVA环境信息:</div>
                                <div class="col-md-7 value"><%=sysInfo.getProperty("java.vm.name") %>
                                    &nbsp;,&nbsp;<%=sysInfo.getProperty("java.runtime.version") %>
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">JDK主目录:</div>
                                <div class="col-md-7 value"><%=sysInfo.getProperty("java.home") %>
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">Servlet容器名称:</div>
                                <div class="col-md-7 value">
                                    <%=getServletContext().getServerInfo() %>
                                    &nbsp;,&nbsp;端口:<%=request.getServerPort() %>
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">启动Servlet容器的用户名:</div>
                                <div class="col-md-7 value">
                                    <%=sysInfo.getProperty("user.name") %>
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">
                                    JDK己用内存数/最大可用数：
                                </div>
                                <div class="col-md-7 value">
                                    <%=(int) (Runtime.getRuntime().freeMemory() / 1024 / 1024) %>
                                    M/<%=(int) (Runtime.getRuntime().totalMemory() / 1024 / 1024) %>M
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">
                                    Servlet容器主目录：
                                </div>
                                <div class="col-md-7 value">
                                    <%=sysInfo.getProperty("user.dir") %>
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">
                                    程序主目录：
                                </div>
                                <div class="col-md-7 value">
                                    <%=request.getRealPath("/") %>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-6 col-sm-12">
                    <div class="portlet red box">
                        <div class="portlet-title">
                            <div class="caption">
                                <i class="fa fa-cogs"></i>数据库信息
                            </div>
                        </div>
                        <div class="portlet-body">
                            <div class="row static-info">
                                <div class="col-md-5 name">
                                    数据库类型:
                                </div>
                                <div class="col-md-7 value">
                                    <%=dbmd.getDatabaseProductName() %>&nbsp;<%=dbmd.getDatabaseProductVersion() %>
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">
                                    数据库服务器地址:
                                </div>
                                <div class="col-md-7 value">
                                    <%=dbmd.getURL() %>
                                </div>
                            </div>
                            <div class="row static-info">
                                <div class="col-md-5 name">
                                    用户名:
                                </div>
                                <div class="col-md-7 value">
                                    <%=dbmd.getUserName() %>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="../common/footer.jsp"/>
</body>
</html>
<%conn.close();%>